package com.sunqianhu.design_patterns_23.behavioral.state;

public class Light {
    private State currentState;
    public Light() {
        this.currentState = new OffState(); // 初始状态为关闭
    }
    public void setState(State state) {
        this.currentState = state;
    }
    public void pressSwitch() {
        currentState.pressSwitch(this); // 委托给当前状态处理
    }
}
